package com.maila.xiaoaobusiness.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.maila.xiaoaobusiness.R;
import com.maila.xiaoaobusiness.adapter.ClassManageMenuAdapter;
import com.maila.xiaoaobusiness.utils.StartActivityUtils;
import com.zhy.autolayout.AutoRelativeLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 分类管理
 * Created by mark on 2017/11/30.
 */

public class ClassManageActivity extends AppCompatActivity {
    @BindView(R.id.white_return_iv)
    AutoRelativeLayout whiteReturnIv;
    @BindView(R.id.lv_menu)
    ListView lvMenu;
    ClassManageMenuAdapter menuAdapter;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_class_manage);
        ButterKnife.bind(this);
        menuAdapter=new ClassManageMenuAdapter(this);
        lvMenu.setAdapter(menuAdapter);
        lvMenu.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                menuAdapter.setIndex(position);
            }
        });
    }

    @OnClick({R.id.white_return_iv, R.id.btn_manage_class, R.id.btn_add_new_good})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.white_return_iv:
                finish();
                break;
            case R.id.btn_manage_class:
                StartActivityUtils.start(this,ClassSortActivity.class);
                break;
            case R.id.btn_add_new_good:
                StartActivityUtils.start(this,AddNewClassActivity.class);
                break;
        }
    }
}
